package com.puris.dao.admin;

import com.puris.dao.BaseDao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

/**
 * @author Sonata
 * @data 2021/11/28 15:18
 */
public class DeleteStudentDaoImpl implements DeleteStudentDao {
    @Override
    public boolean deleteStudent(Connection connection, String id) throws SQLException {
        PreparedStatement statement = null;
        int rows = 0;

        if (connection != null) {
            String sql = "delete from student where id = ?";
            Object[] params = {id};

            rows = BaseDao.execute(connection, statement, sql, params);
        }
        BaseDao.closeResource(null, statement, null);

        return rows != 0;
    }
}
